using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Media;

namespace Elementum.GameEle.Draw
{
    class VolumeBar : Image
    {
        private int max = 8;
        int val;


        public VolumeBar() {
            CurrentAnimation = new Animation("images/system/menu", new Rectangle(272, 204, 30, 45), new Point(30, 45));
            Value = 4;
            Alpha = 1;
            Scale = 1;
        }

        public override void OnDraw(SpriteBatch spriteBatch)
        {
            for (int i = 0; i < val; i++) {
                CurrentAnimation.OnDraw(spriteBatch, Position+new Vector2(i*32,0));
            }
        }

        public int Value {
            set {if(value>=0&&value<=8) 
                val = value;
            float valf = (float)val / (float)max;
            MediaPlayer.Volume = valf;
            }
            get { return val; }
        }
    }
}
